// Bins.h: interface for the CBins class.
//
//////////////////////////////////////////////////////////////////////

#if !defined(AFX_BINS_H__3B003BDA_A715_4AB1_AFBB_B5D0978CAE4E__INCLUDED_)
#define AFX_BINS_H__3B003BDA_A715_4AB1_AFBB_B5D0978CAE4E__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

#include "Strip.h"

struct Bin
{
	float CurrentHeight;
	int Index;
	float *Stack;
	int StackSize;
	Bin()
	{
		CurrentHeight = 0;
		Index = -1;
		StackSize = 0;
		Stack = new float[120];
		for(int i= 0; i<120; i++)
			Stack[i] = 0;
	}
};

class CBinList  
{
private:
	int mSize;
	int mShortestAvailableBin;
	float mLongestBin;
public:
	Bin *mBinList;
	CBinList(int size);
	CBinList(CBinList &binList);
	virtual ~CBinList();
	int GetSize(){return mSize;};
	Bin* GetShortestAvailableBin();
	//Set new value to the element at index i, resort the array if necessary
	bool AddHeight(int i, float value);
	float GetValueAt(int i){ return mBinList[i].CurrentHeight;};
	int GetIndexAt(int i){ return mBinList[i].Index;};
	int FindPositionOfBinIndex(int binIndex);
	void SetBinForUnfilledStrip(CStripList &stripList, int indexUnfilledStrip);
	float GetLongestBinHeight() { return mBinList[mSize-1].CurrentHeight;};
};

#endif // !defined(AFX_BINS_H__3B003BDA_A715_4AB1_AFBB_B5D0978CAE4E__INCLUDED_)
